"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = (app) => {
  const { router, controller, middleware } = app;
  const jwt = middleware.jwt({...app.config.jwt,whitelist:app.config.whitelist});
  const auth = middleware.auth(app.config.whitelist);

  router.post("/upload/:sys/:type", jwt, auth, controller.file.upload);
  router.get("/download/:sys/:type", jwt, auth, controller.file.download);
  router.get("/preview/:sys/:type/:name", jwt, auth, controller.file.preview);
};
